/*
 * SessionBean1.java
 *
 * Created on 21/Jun/2008, 17:05:59
 */
 
package webapp_teste;

import com.sun.data.provider.impl.CachedRowSetDataProvider;
import com.sun.rave.web.ui.appbase.AbstractSessionBean;
import com.sun.sql.rowset.CachedRowSetXImpl;
import javax.faces.FacesException;

/**
 * <p>Session scope data bean for your application.  Create properties
 *  here to represent cached data that should be made available across
 *  multiple HTTP requests for an individual user.</p>
 *
 * <p>An instance of this class will be created for you automatically,
 * the first time your application evaluates a value binding expression
 * or method binding expression that references a managed bean using
 * this class.</p>
 *
 * @author luis.zeferino
 */
public class SessionBean1 extends AbstractSessionBean {
    private String userName;
    private String idUser;
    private String idPerfil;
    
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">

    /**
     * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.</p>
     */
    private void _init() throws Exception {    
        loginDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.loginRowSet}"));
        loginRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        loginRowSet.setCommand("SELECT ALL ADMIN.LOGIN.IDUSER, ADMIN.LOGIN.NOME, ADMIN.LOGIN.APLIDO, ADMIN.LOGIN.EMAIL, ADMIN.LOGIN.LOGIN, ADMIN.LOGIN.PASSWORD, ADMIN.LOGIN.IDPERFIL  FROM ADMIN.LOGIN WHERE ADMIN.LOGIN.LOGIN = ?          AND ADMIN.LOGIN.PASSWORD = ?");
        loginRowSet.setTableName("LOGIN");
        
        perfisDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.perfisRowSet}"));
        perfisRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        perfisRowSet.setCommand("SELECT * FROM ADMIN.PERFIS");
        perfisRowSet.setTableName("PERFIS");
        
        disciplinasDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.disciplinasRowSet}"));
        disciplinasRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        disciplinasRowSet.setCommand("SELECT ALL *  FROM ADMIN.DISCIPLINAS");
        disciplinasRowSet.setTableName("DISCIPLINAS");
        
        criteriosavalDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.criteriosavalRowSet}"));
        criteriosavalRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        criteriosavalRowSet.setCommand("SELECT ALL ADMIN.CRITERIOSAVAL.IDDISCIPLINA, ADMIN.CRITERIOSAVAL.COMPONENTE, ADMIN.CRITERIOSAVAL.PONDERACAO  FROM ADMIN.CRITERIOSAVAL");
        criteriosavalRowSet.setTableName("CRITERIOSAVAL");
        
        allUserDataProvider1.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.allUserRowSet1}"));
        allUserRowSet1.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        allUserRowSet1.setCommand("SELECT * FROM ADMIN.LOGIN");
        allUserRowSet1.setTableName("LOGIN");
        
        tempDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.tempRowSet}"));
        tempRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        tempRowSet.setCommand("SELECT * FROM ADMIN.PERFIS");
        tempRowSet.setTableName("PERFIS");
        
        view_login_responsaveisDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.view_login_responsaveisRowSet}"));
        view_login_responsaveisRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        view_login_responsaveisRowSet.setCommand("SELECT ALL ADMIN.VIEW_LOGIN_RESPONSAVEIS.IDUSER, ADMIN.VIEW_LOGIN_RESPONSAVEIS.NOME, ADMIN.VIEW_LOGIN_RESPONSAVEIS.APLIDO, ADMIN.VIEW_LOGIN_RESPONSAVEIS.EMAIL, ADMIN.VIEW_LOGIN_RESPONSAVEIS.LOGIN, ADMIN.VIEW_LOGIN_RESPONSAVEIS.PASSWORD, ADMIN.VIEW_LOGIN_RESPONSAVEIS.IDPERFIL  FROM ADMIN.VIEW_LOGIN_RESPONSAVEIS");
        view_login_responsaveisRowSet.setTableName("VIEW_LOGIN_RESPONSAVEIS");
        
        view_disciplinas_loginDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.view_disciplinas_loginRowSet}"));
        view_disciplinas_loginRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        view_disciplinas_loginRowSet.setCommand("SELECT ALL ADMIN.VIEW_DISCIPLINAS_LOGIN.DISCIPLINA AS \"Disciplina\", ADMIN.VIEW_DISCIPLINAS_LOGIN.REGENTE AS \"Regente\", ADMIN.VIEW_DISCIPLINAS_LOGIN.DOCENTE AS \"Docente\"  FROM ADMIN.VIEW_DISCIPLINAS_LOGIN");
        view_disciplinas_loginRowSet.setTableName("VIEW_DISCIPLINAS_LOGIN");
        
        view_login_fullnameDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.view_login_fullnameRowSet}"));
        view_login_fullnameRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        view_login_fullnameRowSet.setCommand("SELECT * FROM ADMIN.VIEW_LOGIN_FULLNAME");
        view_login_fullnameRowSet.setTableName("VIEW_LOGIN_FULLNAME");
        
        new_criteriosavalDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.new_criteriosavalRowSet}"));
        new_criteriosavalRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        new_criteriosavalRowSet.setCommand("SELECT ALL ADMIN.CRITERIOSAVAL.IDDISCIPLINA, ADMIN.CRITERIOSAVAL.COMPONENTE, ADMIN.CRITERIOSAVAL.PONDERACAO  FROM ADMIN.CRITERIOSAVAL WHERE ADMIN.CRITERIOSAVAL.IDDISCIPLINA = ?");
        new_criteriosavalRowSet.setTableName("CRITERIOSAVAL");
        
        disciplinasCriteriosDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.disciplinasCriteriosRowSet}"));
        disciplinasCriteriosRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        disciplinasCriteriosRowSet.setCommand("SELECT ALL ADMIN.DISCIPLINAS.IDDISCIPLINA, ADMIN.DISCIPLINAS.DISCIPLINA, ADMIN.DISCIPLINAS.IDRESPONSAVEL, ADMIN.DISCIPLINAS.IDNORMAL  FROM ADMIN.DISCIPLINAS WHERE ADMIN.DISCIPLINAS.IDRESPONSAVEL = ?");
        disciplinasCriteriosRowSet.setTableName("DISCIPLINAS");
        
        disciplinasResponsaveisDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.disciplinasResponsaveisRowSet}"));
        disciplinasResponsaveisRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        disciplinasResponsaveisRowSet.setCommand("SELECT ALL ADMIN.DISCIPLINAS.IDDISCIPLINA, ADMIN.DISCIPLINAS.DISCIPLINA, ADMIN.DISCIPLINAS.IDRESPONSAVEL, ADMIN.DISCIPLINAS.IDNORMAL  FROM ADMIN.DISCIPLINAS WHERE ADMIN.DISCIPLINAS.IDRESPONSAVEL = ?");
        disciplinasResponsaveisRowSet.setTableName("DISCIPLINAS");
        view_criteriosavalDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.view_criteriosavalRowSet}"));
        view_criteriosavalRowSet.setDataSourceName("java:comp/env/jdbc/ADMIN_ApacheDerby");
        view_criteriosavalRowSet.setCommand("SELECT ALL ADMIN.CRITERIOSAVAL.IDDISCIPLINA, ADMIN.CRITERIOSAVAL.COMPONENTE, ADMIN.CRITERIOSAVAL.PONDERACAO  FROM ADMIN.CRITERIOSAVAL WHERE ADMIN.CRITERIOSAVAL.IDDISCIPLINA = ?");
        view_criteriosavalRowSet.setTableName("CRITERIOSAVAL");
    }
    private CachedRowSetDataProvider loginDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getLoginDataProvider() {
        return loginDataProvider;
    }

    public void setLoginDataProvider(CachedRowSetDataProvider crsdp) {
        this.loginDataProvider = crsdp;
    }
    private CachedRowSetXImpl loginRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getLoginRowSet() {
        return loginRowSet;
    }

    public void setLoginRowSet(CachedRowSetXImpl crsxi) {
        this.loginRowSet = crsxi;
    }
    private CachedRowSetDataProvider view_login_perfilDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getView_login_perfilDataProvider() {
        return view_login_perfilDataProvider;
    }

    public void setView_login_perfilDataProvider(CachedRowSetDataProvider crsdp) {
        this.view_login_perfilDataProvider = crsdp;
    }
    private CachedRowSetDataProvider perfisDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getPerfisDataProvider() {
        return perfisDataProvider;
    }

    public void setPerfisDataProvider(CachedRowSetDataProvider crsdp) {
        this.perfisDataProvider = crsdp;
    }
    private CachedRowSetXImpl perfisRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getPerfisRowSet() {
        return perfisRowSet;
    }

    public void setPerfisRowSet(CachedRowSetXImpl crsxi) {
        this.perfisRowSet = crsxi;
    }
    private CachedRowSetDataProvider disciplinasDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getDisciplinasDataProvider() {
        return disciplinasDataProvider;
    }

    public void setDisciplinasDataProvider(CachedRowSetDataProvider crsdp) {
        this.disciplinasDataProvider = crsdp;
    }
    private CachedRowSetXImpl disciplinasRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getDisciplinasRowSet() {
        return disciplinasRowSet;
    }

    public void setDisciplinasRowSet(CachedRowSetXImpl crsxi) {
        this.disciplinasRowSet = crsxi;
    }
    private CachedRowSetDataProvider criteriosavalDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getCriteriosavalDataProvider() {
        return criteriosavalDataProvider;
    }

    public void setCriteriosavalDataProvider(CachedRowSetDataProvider crsdp) {
        this.criteriosavalDataProvider = crsdp;
    }
    private CachedRowSetXImpl criteriosavalRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getCriteriosavalRowSet() {
        return criteriosavalRowSet;
    }

    public void setCriteriosavalRowSet(CachedRowSetXImpl crsxi) {
        this.criteriosavalRowSet = crsxi;
    }
    private CachedRowSetDataProvider allUserDataProvider1 = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getAllUserDataProvider1() {
        return allUserDataProvider1;
    }

    public void setAllUserDataProvider1(CachedRowSetDataProvider crsdp) {
        this.allUserDataProvider1 = crsdp;
    }
    private CachedRowSetXImpl allUserRowSet1 = new CachedRowSetXImpl();

    public CachedRowSetXImpl getAllUserRowSet1() {
        return allUserRowSet1;
    }

    public void setAllUserRowSet1(CachedRowSetXImpl crsxi) {
        this.allUserRowSet1 = crsxi;
    }
    private CachedRowSetDataProvider tempDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getTempDataProvider() {
        return tempDataProvider;
    }

    public void setTempDataProvider(CachedRowSetDataProvider crsdp) {
        this.tempDataProvider = crsdp;
    }
    private CachedRowSetXImpl tempRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getTempRowSet() {
        return tempRowSet;
    }

    public void setTempRowSet(CachedRowSetXImpl crsxi) {
        this.tempRowSet = crsxi;
    }
    private CachedRowSetDataProvider view_login_responsaveisDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getView_login_responsaveisDataProvider() {
        return view_login_responsaveisDataProvider;
    }

    public void setView_login_responsaveisDataProvider(CachedRowSetDataProvider crsdp) {
        this.view_login_responsaveisDataProvider = crsdp;
    }
    private CachedRowSetXImpl view_login_responsaveisRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getView_login_responsaveisRowSet() {
        return view_login_responsaveisRowSet;
    }

    public void setView_login_responsaveisRowSet(CachedRowSetXImpl crsxi) {
        this.view_login_responsaveisRowSet = crsxi;
    }
    private CachedRowSetDataProvider view_disciplinas_loginDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getView_disciplinas_loginDataProvider() {
        return view_disciplinas_loginDataProvider;
    }

    public void setView_disciplinas_loginDataProvider(CachedRowSetDataProvider crsdp) {
        this.view_disciplinas_loginDataProvider = crsdp;
    }
    private CachedRowSetXImpl view_disciplinas_loginRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getView_disciplinas_loginRowSet() {
        return view_disciplinas_loginRowSet;
    }

    public void setView_disciplinas_loginRowSet(CachedRowSetXImpl crsxi) {
        this.view_disciplinas_loginRowSet = crsxi;
    }
    private CachedRowSetDataProvider disciplinaDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getDisciplinaDataProvider() {
        return disciplinaDataProvider;
    }

    public void setDisciplinaDataProvider(CachedRowSetDataProvider crsdp) {
        this.disciplinaDataProvider = crsdp;
    }
    private CachedRowSetDataProvider view_login_fullnameDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getView_login_fullnameDataProvider() {
        return view_login_fullnameDataProvider;
    }

    public void setView_login_fullnameDataProvider(CachedRowSetDataProvider crsdp) {
        this.view_login_fullnameDataProvider = crsdp;
    }
    private CachedRowSetXImpl view_login_fullnameRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getView_login_fullnameRowSet() {
        return view_login_fullnameRowSet;
    }

    public void setView_login_fullnameRowSet(CachedRowSetXImpl crsxi) {
        this.view_login_fullnameRowSet = crsxi;
    }
    private CachedRowSetDataProvider new_criteriosavalDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getNew_criteriosavalDataProvider() {
        return new_criteriosavalDataProvider;
    }

    public void setNew_criteriosavalDataProvider(CachedRowSetDataProvider crsdp) {
        this.new_criteriosavalDataProvider = crsdp;
    }
    private CachedRowSetXImpl new_criteriosavalRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getNew_criteriosavalRowSet() {
        return new_criteriosavalRowSet;
    }

    public void setNew_criteriosavalRowSet(CachedRowSetXImpl crsxi) {
        this.new_criteriosavalRowSet = crsxi;
    }
    private CachedRowSetDataProvider disciplinasCriteriosDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getDisciplinasCriteriosDataProvider() {
        return disciplinasCriteriosDataProvider;
    }

    public void setDisciplinasCriteriosDataProvider(CachedRowSetDataProvider crsdp) {
        this.disciplinasCriteriosDataProvider = crsdp;
    }
    private CachedRowSetXImpl disciplinasCriteriosRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getDisciplinasCriteriosRowSet() {
        return disciplinasCriteriosRowSet;
    }

    public void setDisciplinasCriteriosRowSet(CachedRowSetXImpl crsxi) {
        this.disciplinasCriteriosRowSet = crsxi;
    }
    private CachedRowSetDataProvider disciplinasResponsaveisDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getDisciplinasResponsaveisDataProvider() {
        return disciplinasResponsaveisDataProvider;
    }

    public void setDisciplinasResponsaveisDataProvider(CachedRowSetDataProvider crsdp) {
        this.disciplinasResponsaveisDataProvider = crsdp;
    }
    private CachedRowSetXImpl disciplinasResponsaveisRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getDisciplinasResponsaveisRowSet() {
        return disciplinasResponsaveisRowSet;
    }

    public void setDisciplinasResponsaveisRowSet(CachedRowSetXImpl crsxi) {
        this.disciplinasResponsaveisRowSet = crsxi;
    }
    private CachedRowSetDataProvider view_criteriosavalDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getView_criteriosavalDataProvider() {
        return view_criteriosavalDataProvider;
    }

    public void setView_criteriosavalDataProvider(CachedRowSetDataProvider crsdp) {
        this.view_criteriosavalDataProvider = crsdp;
    }
    private CachedRowSetXImpl view_criteriosavalRowSet = new CachedRowSetXImpl();

    public CachedRowSetXImpl getView_criteriosavalRowSet() {
        return view_criteriosavalRowSet;
    }

    public void setView_criteriosavalRowSet(CachedRowSetXImpl crsxi) {
        this.view_criteriosavalRowSet = crsxi;
    }
    // </editor-fold>
  
 
    /**
     * <p>Construct a new session data bean instance.</p>
     */
    public SessionBean1() {
    }

    /**
     * <p>This method is called when this bean is initially added to
     * session scope.  Typically, this occurs as a result of evaluating
     * a value binding or method binding expression, which utilizes the
     * managed bean facility to instantiate this bean and store it into
     * session scope.</p>
     * 
     * <p>You may customize this method to initialize and cache data values
     * or resources that are required for the lifetime of a particular
     * user session.</p>
     */
    @Override
    public void init() {
        // Perform initializations inherited from our superclass
        super.init();
        // Perform application initialization that must complete
        // *before* managed components are initialized
        // TODO - add your own initialiation code here
        
        // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("SessionBean1 Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
        }
        
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        // TODO - add your own initialization code here
    }

    /**
     * <p>This method is called when the session containing it is about to be
     * passivated.  Typically, this occurs in a distributed servlet container
     * when the session is about to be transferred to a different
     * container instance, after which the <code>activate()</code> method
     * will be called to indicate that the transfer is complete.</p>
     * 
     * <p>You may customize this method to release references to session data
     * or resources that can not be serialized with the session itself.</p>
     */
    @Override
    public void passivate() {
    }

    /**
     * <p>This method is called when the session containing it was
     * reactivated.</p>
     * 
     * <p>You may customize this method to reacquire references to session
     * data or resources that could not be serialized with the
     * session itself.</p>
     */
    @Override
    public void activate() {
    }

    /**
     * <p>This method is called when this bean is removed from
     * session scope.  Typically, this occurs as a result of
     * the session timing out or being terminated by the application.</p>
     * 
     * <p>You may customize this method to clean up resources allocated
     * during the execution of the <code>init()</code> method, or
     * at any later time during the lifetime of the application.</p>
     */
    @Override
    public void destroy() {
        loginDataProvider.close();
        view_login_perfilDataProvider.close();
        perfisDataProvider.close();
        disciplinasDataProvider.close();
        criteriosavalDataProvider.close();
        allUserDataProvider1.close();
        tempDataProvider.close();
        view_login_responsaveisDataProvider.close();
        view_disciplinas_loginDataProvider.close();
        disciplinaDataProvider.close();
        view_login_fullnameDataProvider.close();
        new_criteriosavalDataProvider.close();
        disciplinasCriteriosDataProvider.close();
        disciplinasResponsaveisDataProvider.close();
        view_criteriosavalDataProvider.close();
    }
    
    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected ApplicationBean1 getApplicationBean1() {
        return (ApplicationBean1) getBean("ApplicationBean1");
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getIdUser() {
        return idUser;
    }

    public void setIdUser(String idUser) {
        this.idUser = idUser;
    }

    public String getIdPerfil() {
        return idPerfil;
    }

    public void setIdPerfil(String idPerfil) {
        this.idPerfil = idPerfil;
    }

}
